<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>03-PropTypes定义在类中</title>
	<link href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet">
	<script src="http://static.web.sdo.com/chuanshi/common/react.development.js"></script>
	<script src="http://static.web.sdo.com/chuanshi/common/react-dom.development.js"></script>
	<script src="http://static.web.sdo.com/chuanshi/common/babel.min.js"></script>
	<script src="http://static.web.sdo.com/chuanshi/common/prop-types.js"></script>
</head>
<body>
	<div class="container" style="padding-top:200px">
		<div id="app"></div>	
	</div>
</body>
</html>
<script type="text/babel">
	class Child extends React.Component{
		static propTypes={
			title:PropTypes.string.isRequired,
			counts:PropTypes.number.isRequired
		}
		static defaultProps={
			title:'默认标题',
			counts:45
		}
		render(){
			return (
				<div className="text-danger">{this.props.title}&nbsp;&nbsp;{typeof(this.props.counts)}</div>
			)
		}
	}
	


	class Parent extends React.Component{
		render(){
			return (
				<div className="row">
					<Child  />
				</div>
			)
		}
	}

	ReactDOM.render(<Parent/>,document.getElementById('app'))
</script>